Density is defined as the ratio of mass to volume for a substance at a specific temperature.
Mathematically,
Most liquids are incompressible so their densities do not vary much with temperature or pressure. The relationship between the density, temperature, and pressure of a gas is described by the gas laws.
Specific gravity is defined as the ratio of the density of a substance to the density of water.